
OpenBlock.I18N['newChatContext'] = '创建聊天上下文';
OpenBlock.I18N['LLM_Context'] = '大模型聊天上下文';
OpenBlock.I18N['LLM_Finished'] = '大模型回复';
OpenBlock.I18N['newChat'] = '创建大模型对话';
OpenBlock.I18N['LLM_Chat'] = '大模型对话';
OpenBlock.I18N['chat'] = '对话';
OpenBlock.I18N['context'] = '上下文';
OpenBlock.I18N['modelName'] = '模型名称';
OpenBlock.I18N['newChat'] = '新对话';
OpenBlock.I18N['role'] = '角色';
OpenBlock.I18N['system'] = '系统';
OpenBlock.I18N['user'] = '用户';
OpenBlock.I18N['assistant'] = '助理';
OpenBlock.I18N['llm-completions'] = '大语言模型对话';
OpenBlock.I18N['setModel'] = '设置模型';
OpenBlock.I18N['addPrompt'] = '添加提示词';
OpenBlock.I18N['sendChat'] = '发送对话（接收大模型聊天上下文消息）';
OpenBlock.I18N['reply_title'] = '回复消息标题';
OpenBlock.I18N['chatCount'] = '对话数量';
OpenBlock.I18N['chatAt'] = '获取指定索引的对话';
OpenBlock.I18N['appendChat_1'] = '追加对话';
OpenBlock.I18N['appendChat'] = '追加对话';
OpenBlock.I18N['removeChatAt'] = '删除指定索引的对话';
OpenBlock.I18N['insertChatAt'] = '在索引处插入对话';
OpenBlock.I18N['getChatRole'] = '获取对话角色';
OpenBlock.I18N['SetChatRole'] = '设置对话角色';
OpenBlock.I18N['getChatContent'] = '获取对话内容';
OpenBlock.I18N['setChatContent'] = '设置对话内容';
OpenBlock.I18N['setParam'] = '设置参数';

OpenBlock.Env.registerNativeTypes(['server'], {
    'LLM_Context': [],
    'LLM_Chat': [],
});
let roleProvider = {
    type: 'dropdown', property: [['system', 'system'], ['user', 'user'], ['assistant', 'assistant']], valueType: 'String'
};
let modelProvider = {
    type: 'dropdown', property: [
        ['角色扮演', '角色扮演'],
        ['高性能', '高性能'],
        ['强逻辑', '强逻辑'],
        ['长上下文', '长上下文'],
        ['逐步推理', '逐步推理'],
        ['蒸馏模型逐步推理', '蒸馏模型逐步推理'],
    ], valueType: 'String'
};
let paramProvider = {
    type: 'dropdown', property: [
        ['max_tokens', 'max_tokens'],
        ['frequency_penalty', 'frequency_penalty'],
        ['presence_penalty', 'presence_penalty'],
        ['temperature', 'temperature'],
        ['top_p', 'top_p'],
    ], valueType: 'String'
};
OpenBlock.Env.registerNativeFunction(['server'], 'llm-completions', 'llm-completions', [
    {
        method_name: 'newChatContext', arguments: [
        ], returnType: 'LLM_Context'
    },
    {
        method_name: 'newChat', arguments: [
        ], returnType: 'LLM_Chat'
    },
    {
        method_name: 'setModel', arguments: [
            { type: 'LLM_Context', name: 'context' },
            { type: 'String', name: 'modelName', provider: modelProvider },
        ], returnType: 'void'
    },
    {
        method_name: 'sendChat', arguments: [
            { type: 'LLM_Context', name: 'context' },
            { type: 'String', name: 'reply_title' },
        ], returnType: 'void'
    },
    {
        method_name: 'chatCount', arguments: [
            { type: 'LLM_Context', name: 'context' },
        ], returnType: 'Integer'
    },
    {
        method_name: 'chatAt', arguments: [
            { type: 'LLM_Context', name: 'context' },
            { type: 'Integer', name: 'index' },
        ], returnType: 'LLM_Chat'
    },
    {
        method_name: 'appendChat_1', arguments: [
            { type: 'LLM_Context', name: 'context' },
            {
                type: 'String', name: 'role', provider: roleProvider
            },
            { type: 'String', name: 'content' },
        ], returnType: 'void'
    },
    {
        method_name: 'appendChat', arguments: [
            { type: 'LLM_Context', name: 'context' },
            { type: 'LLM_Chat', name: 'chat' }
        ], returnType: 'void'
    },
    {
        method_name: 'removeChatAt', arguments: [
            { type: 'LLM_Context', name: 'context' },
            { type: 'Integer', name: 'index' },
        ], returnType: 'LLM_Chat'
    },
    {
        method_name: 'insertChatAt', arguments: [
            { type: 'LLM_Context', name: 'context' },
            { type: 'LLM_Chat', name: 'chat' },
        ], returnType: 'void'
    },
    {
        method_name: 'getChatRole', arguments: [
            { type: 'LLM_Chat', name: 'chat' },
        ], returnType: 'String'
    },
    {
        method_name: 'SetChatRole', arguments: [
            { type: 'LLM_Chat', name: 'chat' },
            { type: 'String', name: 'role', provider: roleProvider },
        ], returnType: 'void'
    },
    {
        method_name: 'getChatContent', arguments: [
            { type: 'LLM_Chat', name: 'chat' },
        ], returnType: 'String'
    },
    {
        method_name: 'setChatContent', arguments: [
            { type: 'LLM_Chat', name: 'chat' },
            { type: 'String', name: 'content' },
        ], returnType: 'void'
    },
    {
        method_name: 'setParam', arguments: [
            { type: 'LLM_Context', name: 'context' },
            { type: 'String', name: 'name', provider: paramProvider },
            { type: 'Number', name: 'value' },
        ], returnType: 'void'
    },

]);
